home *** CD-ROM | disk | FTP | other *** search
INI File | 1995-05-01 | 1.4 KB | 59 lines |
- [1]
- CenterForm centers the form passed to it horizontally and vertically on the screen.
- [Code]
- Sub CenterForm (F As Form)
- F.Left = (Screen.Width - F.Width) / 2
- F.Top = (Screen.Height - F.Height) / 2
- End Sub
- [Stop]
- [2]
- DblClick Event Example
- [Code]
- The example displays a selected list item in a text box when either a command button is clicked or
- a list item is double-clicked. To try this example, paste the code into the Declarations section of a
- form that contains list box, a text box and a command button. Then press F5 and click the
- command button or double click a list box item.
-
- Sub Form_Load ()
- List1.AddItem "John" ' Add list box entries.
- List1.AddItem "Paul"
- List1.AddItem "George"
- List1.AddItem "Ringo"
- End Sub
-
-
-
- Sub List1_DblClick ()
- Command1.Value = True ' Trigger Click event.
- End Sub
-
-
-
- Sub Command1_Click ()
- Text1.Text = List1.Text ' Display selection.
- End Sub
-
-
-
- [Stop]
- [3]
- ActiveControl Property Example 1
-
-
- [Code]
- The example displays the text of the active control. To try this example, paste the code into the
- Declarations section of a form that contains a text box, a label, and a command button. Then press F5
- and click the form.
- Sub Form_Click ()
- If TypeOf Screen.ActiveControl Is TextBox Then
- Label1.Caption = Screen.ActiveControl.Text
- Else
- Label1.Caption = "Button: " + Screen.ActiveControl.Caption
- End If
- End Sub
-
-
-
-
- [Stop]
-